package com.ds.infrastructure.hyperspace.console.entity.enums;

/**
 * @author: yaozhendong
 * @create: 2019-10-23 11:29
 **/

public interface TbDeployNodeEnum {

    /**
     * TEMP_TYPE类型:1(ONE);2(TWO)
     */
    enum DEPLOY_STATE {
        INIT(1, "部署安装状态-初始化（未执行状态）"),
        SUCCESS(2, "成功"),
        FAIL(3, "失败");

        public final Integer code;
        private final String desc;

        DEPLOY_STATE(Integer code, String desc) {
            this.code = code;
            this.desc = desc;
        }

        public static DEPLOY_STATE toEnum(int value) {
            for (DEPLOY_STATE item : DEPLOY_STATE.values()) {
                if (item.code == value) {
                    return item;
                }
            }
            return null;
        }
    }

    /**
     * TEMP_TYPE类型:1(ONE);2(TWO)
     */
    enum ACTIVE_STATE {
        INIT(1, "部署激活状态-初始化（未执行状态）"),
        SUCCESS(2, "成功"),
        FAIL(3, "失败");

        public final Integer code;
        private final String desc;

        ACTIVE_STATE(Integer code, String desc) {
            this.code = code;
            this.desc = desc;
        }

        public static ACTIVE_STATE toEnum(int value) {
            for (ACTIVE_STATE item : ACTIVE_STATE.values()) {
                if (item.code == value) {
                    return item;
                }
            }
            return null;
        }
    }

    /**
     * 健康状态(0：未执行；1：连接成功；2：连接失败)
     */
    enum HEALTH_STATE {
        INIT(1, "节点健康状态-初始化（未执行状态）"),
        SUCCESS(2, "连接成功"),
        FAIL(3, "连接失败");

        public final Integer code;
        private final String desc;

        HEALTH_STATE(Integer code, String desc) {
            this.code = code;
            this.desc = desc;
        }

        public static HEALTH_STATE toEnum(int value) {
            for (HEALTH_STATE item : HEALTH_STATE.values()) {
                if (item.code == value) {
                    return item;
                }
            }
            return null;
        }
    }
}
